package com.ruoyi.web.wuliu.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.wuliu.mapper.TCompanyMapper;
import com.ruoyi.web.wuliu.domain.TCompany;
import com.ruoyi.web.wuliu.service.ITCompanyService;

/**
 * 储仓分流Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-20
 */
@Service
public class TCompanyServiceImpl implements ITCompanyService 
{
    @Autowired
    private TCompanyMapper tCompanyMapper;

    /**
     * 查询储仓分流
     * 
     * @param id 储仓分流主键
     * @return 储仓分流
     */
    @Override
    public TCompany selectTCompanyById(Long id)
    {
        //增加浏览量
        TCompany tCompany = tCompanyMapper.selectTCompanyById(id);
        tCompany.setBrowseCount(tCompany.getBrowseCount()+1);
        tCompanyMapper.updateTCompany(tCompany);
        return tCompany;
    }

    /**
     * 查询储仓分流列表
     * 
     * @param tCompany 储仓分流
     * @return 储仓分流
     */
    @Override
    public List<TCompany> selectTCompanyList(TCompany tCompany)
    {
        return tCompanyMapper.selectTCompanyList(tCompany);
    }

    /**
     * 新增储仓分流
     * 
     * @param tCompany 储仓分流
     * @return 结果
     */
    @Override
    public int insertTCompany(TCompany tCompany)
    {
        tCompany.setCreateTime(DateUtils.getNowDate());
        return tCompanyMapper.insertTCompany(tCompany);
    }

    /**
     * 修改储仓分流
     * 
     * @param tCompany 储仓分流
     * @return 结果
     */
    @Override
    public int updateTCompany(TCompany tCompany)
    {
        return tCompanyMapper.updateTCompany(tCompany);
    }

    /**
     * 批量删除储仓分流
     * 
     * @param ids 需要删除的储仓分流主键
     * @return 结果
     */
    @Override
    public int deleteTCompanyByIds(Long[] ids)
    {
        return tCompanyMapper.deleteTCompanyByIds(ids);
    }

    /**
     * 删除储仓分流信息
     * 
     * @param id 储仓分流主键
     * @return 结果
     */
    @Override
    public int deleteTCompanyById(Long id)
    {
        return tCompanyMapper.deleteTCompanyById(id);
    }
}
